-
Notifications
You must be signed in to change notification settings - Fork 321
Port #3841 to 6.1: Introduce app context switch for setting MSF=true #3851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5572da6 to
99d6fa3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR ports #3841 to the release/6.1 branch, introducing an app context switch (Switch.Microsoft.Data.SqlClient.EnableMultiSubnetFailoverByDefault) that allows applications to enable MultiSubnetFailover by default without explicitly setting it in each connection string. When the switch is set to true, MultiSubnetFailover defaults to true instead of false, enabling parallel IP connection attempts for improved connection times in multi-subnet environments.
Key changes:
- Added new app context switch
EnableMultiSubnetFailoverByDefaultwith tristate lazy initialization pattern - Changed
MultiSubnetFailoverdefault from const to static property to allow runtime evaluation based on the app context switch - Added comprehensive test coverage for the new switch behavior including unit and functional tests
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs |
Added EnableMultiSubnetFailoverByDefault property and backing field with tristate lazy initialization |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionStringDefaults.cs |
Changed MultiSubnetFailover from const to static property that evaluates the app context switch |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs |
Changed DEFAULT.MultiSubnetFailover from const to static property to support runtime evaluation |
src/Microsoft.Data.SqlClient/tests/Common/LocalAppContextSwitchesHelper.cs |
Added test helper infrastructure for manipulating and restoring the new switch value |
src/Microsoft.Data.SqlClient/tests/FunctionalTests/LocalAppContextSwitchesTests.cs |
Added test to verify the new switch defaults to false |
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/SqlConnectionStringTest.cs |
Added parameterized test for MultiSubnetFailover behavior with various combinations of connection string values and app context switch states; includes commented-out test for FailoverPartner validation |
...Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/SqlConnectionStringTest.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/6.1 #3851 +/- ##
===============================================
- Coverage 66.21% 64.30% -1.91%
===============================================
Files 279 279
Lines 53293 53301 +8
===============================================
- Hits 35286 34275 -1011
- Misses 18007 19026 +1019
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Ports #3841 to release branch 6.1
Issues
AB#41015
Guidelines
Please review the contribution guidelines before submitting a pull request: